/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = __bytebuff_node_free.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2016/04/13 by jikw                                 */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "conntrack.h"
#include "frct_comm.h"
#include "frbyte_buffer.h"

#include "apmtest_comm.h"

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}

extern void __bytebuff_node_free(Frlist_node* node);

static void case1(void)
{
    Frlist_node *p_st_node = NULL;
    Frbyte_buffer *p_bytebuf = NULL;
    
    p_bytebuf = (Frbyte_buffer *)frmalloc(sizeof(Frbyte_buffer));
    
    p_bytebuf->pos = 0;
    p_bytebuf->p_buf = frstrdup("test");
    p_bytebuf->ui_len = 4;
    
    p_st_node = frlist_node_create(p_bytebuf);
    
    __bytebuff_node_free(p_st_node);
    
    frfree(p_st_node);
}

int add_suite__bytebuff_node_free(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite("frcomm __bytebuff_node_free()", __suite_init, __suite_cleanup)) == NULL)
    return FR_FAIL;

    CU_add_test(pSuite, "case1", case1);

    return FR_SUCC;
}
